// Decompiled by Jad v1.5.7f. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   LMSErrorManager.java

package com.iphaeton.lms.course.scorm12.runtime.client;


public class LMSErrorManager
{

    public LMSErrorManager()
    {
    }

    public void LMSErrorManager()
    {
        currentErrorCode = "0";
    }

    public String GetCurrentErrorCode()
    {
        return currentErrorCode;
    }

    public void SetCurrentErrorCode(String code)
    {
        if(code != null && code != "")
            currentErrorCode = code;
        else
            currentErrorCode = "0";
    }

    public void ClearCurrentErrorCode()
    {
        currentErrorCode = errors[0][0];
    }

    public String GetErrorDescription(String code)
    {
        if(code != null && code != "")
            return GetErrorElement(code)[1];
        else
            return "";
    }

    public String GetErrorDiagnostic(String code)
    {
        if(code != null && code != "")
            return GetErrorElement(code)[2];
        else
            return GetErrorElement(currentErrorCode)[2];
    }

    private String[] GetErrorElement(String code)
    {
        for(int i = 0; i < errors.length; i++)
            if(errors[i][0].equalsIgnoreCase(code))
                return errors[i];

        String tmp[] = {
            "", "", ""
        };
        return tmp;
    }

    private static String currentErrorCode;
    private static String errors[][] = {
        {
            "0", "No Error", "The previous LMS API Function call completed successfully."
        }, {
            "101", "General Exception", "An unspecified, unexpected exception has occured"
        }, {
            "201", "Invalid argument error", ""
        }, {
            "202", "Element cannot have children", ""
        }, {
            "203", "Element not an array - cannot have count", ""
        }, {
            "301", "Not initialized", "The LMS is not initialized."
        }, {
            "401", "Not implemented error", "The data model element in question was not implemented"
        }, {
            "402", "Invalid set value, element is a keyword", "Trying to set a reserved keyword in the data modelTrying to set a keyword (_count, _children, or _version) This is prohibited"
        }, {
            "403", "Element is read only", "Data Element is Read Only (Not Writeable)Cannot call LMSSetValue() for the element in question"
        }, {
            "404", "Element is write only", "Data Element is Write Only (Not Readable)Cannot call LMSGetValue() for the element in question"
        }, {
            "405", "Incorrect Data Type", "Invalid Type being used for setting elementThe type being used as the set value argument does not match that of the element being set"
        }
    };

}
